From 4c49c0a297d67102175fac645762682476336620 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Mon, 16 Nov 2015 12:51:42 +0100 Subject: [PATCH] wayland: Move additional pointer buttons after the old 4-7 scrolling ones We were using that range for the extra buttons after left/right/middle, while this is harmless for clients not handling extra buttons (we used to translate those button events into scroll events in x11 anyway) this will be unexpected for clients that do handle additional mouse buttons themselves (eg. back/forward buttons present in some mice). In order to remain compatible with X11, those need to be assigned from button 8 onwards. Also, include input.h, and stop using magic numbers here. https://bugzilla.gnome.org/show_bug.cgi?id=758072 --- gdk/wayland/gdkdevice-wayland.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index 84a1167fde..157630f34f 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -33,9 +33,13 @@ #include +#include + #include #include +#define BUTTON_BASE (BTN_LEFT - 1) /* Used to translate to 1-indexed buttons */ + typedef struct _GdkWaylandTouchData GdkWaylandTouchData; struct _GdkWaylandTouchData @@ -1018,14 +1022,18 @@ pointer_handle_button (void *data, switch (button) { - case 273: - gdk_button = 3; + case BTN_LEFT: + gdk_button = GDK_BUTTON_PRIMARY; + break; + case BTN_MIDDLE: + gdk_button = GDK_BUTTON_MIDDLE; break; - case 274: - gdk_button = 2; + case BTN_RIGHT: + gdk_button = GDK_BUTTON_SECONDARY; break; default: - gdk_button = button - 271; + /* For compatibility reasons, all additional buttons go after the old 4-7 scroll ones */ + gdk_button = button - BUTTON_BASE + 4; break; } -- 2.30.2